﻿using System.Collections.Generic;
using System.Xml.Serialization;
using Inkubator.Wizard.Model.Style;
using Inkubator.Wizard.Model.ConditionalMode;
using Inkubator.Wizard.Model.Interaction;

namespace Inkubator.Wizard.Model.Model
{
    /// <summary>
    /// This class provides the representation of the XML File
    /// and its components
    /// </summary>
    [XmlRoot("wizard")]
    public class WizardModel
    {
        //GLOBAL ATTRIBUTES
        public string title;

        /// <summary>
        /// actionAtEnd establish if the Wizard will execute all
        /// the actions specified for each step at the end of the
        /// Wizard (when the user press Finish) or when each step finalize
        /// </summary>
        public bool actionsAtEnd;

        public bool summary;

        /// <summary>
        /// preAction establish if the Wizard will execute a DLL or EXE before
        /// loading the page to prepare the environment
        /// </summary>
        public DoAction preActionn;
        /// <summary>
        /// postAction establish if the Wizard will execute an action after
        /// all the actions in each step are executed.
        /// </summary>
        public DoAction postAction;

        /// <summary>
        /// StepProgress is a construction that allow who write the XML File to
        /// specified some condition that the Wizard will analyze in each Step to
        /// know which Step has to follow the actual one.
        /// This construction will be useful if the Wizard execution is not lineal.
        /// The Conditions can be represented as regular expression or a DLL/EXE to
        /// be executed.
        /// </summary>
        public StepProgress stepProgress;

        /// <summary>
        /// Steps is a List that represent each step that belongs to the Wizard Control
        /// </summary>
        public List<Step> steps;
        /// <summary>
        /// This Construction allow to the person who write the XML File to configure
        /// how the Wizard will be generated on the Web Page.
        /// </summary>
        public StyleXml style;

        public WizardModel()
        {
            steps = new List<Step>();
        }

        public WizardModel( List<Step> step )
        {
            this.steps = step;
        }

        /// <summary>
        /// This Method receive a Step Object by argument and add this object to the
        /// Steps List Object.
        /// </summary>
        /// <param name="step"></param>
        public void AddStep(Step step)
        {
            steps.Add(step);
        }

    }
}
